package com.chuangsi.project.admin.controller.admin;


import com.chuangsi.framework.web.domain.ResultObject;
import com.chuangsi.project.admin.dto.admin.index.*;
import com.chuangsi.project.admin.dto.app.index.*;
import com.chuangsi.project.admin.service.IIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 首页统计 前端控制器
 * </p>
 *
 * @author ywb
 * @since 2025-02-25
 */
@Api(tags="PC-首页")
@RestController
@RequestMapping("/adminApi/index")
public class IndexController {

    @Autowired
    private IIndexService indexService;


    @ApiOperation(value = "当日销售额分析", notes = "ywb")
    @GetMapping("/getDaySalesForPc")
    public ResultObject<DaySalesDto> getDaySalesForPc(ReqIndexDto req) {
        DaySalesDto sales = indexService.getDaySalesForPc(req);
        return ResultObject.ok().setData(sales);
    }

    @ApiOperation(value = "当月销售额分析", notes = "ywb")
    @GetMapping("/getMonthSalesForPc")
    public ResultObject<MonthSalesDto> getMonthSalesForPc(ReqIndexDto req) {
        MonthSalesDto sales = indexService.getMonthSalesForPc(req);
        return ResultObject.ok().setData(sales);
    }

    @ApiOperation(value = "获取总销售金额", notes = "ywb")
    @GetMapping("/getTotalSalesAmountForPc")
    public ResultObject<Void> getTotalSalesAmountForPc(ReqIndexDto req) {
        BigDecimal salesAmount = indexService.getTotalSalesAmountForPc(req);
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "获取总销售订单数", notes = "ywb")
    @GetMapping("/getTotalSalesNumForPc")
    public ResultObject<Void> getTotalSalesNumForPc(ReqIndexDto req) {
        BigDecimal salesAmount = indexService.getTotalSalesNumForPc(req);
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "获取部门销售排行", notes = "ywb")
    @GetMapping("/getDeptSalesRankForPc")
    public ResultObject<List<ResDeptRankDto>> getDeptSalesRankForPc(ReqIndexDto req) {
        List<ResDeptRankDto> rankList = indexService.getDeptSalesRankForPc(req);
        return ResultObject.ok().setData(rankList);
    }

    @ApiOperation(value = "获取本年内销售额折线图", notes = "ywb")
    @GetMapping("/getMonthSalesAmountLineChartForPc")
    public ResultObject<MonthSalesAmountLineChartDto> getMonthSalesAmountLineChartForPc(ReqIndexDto req) {
        List<MonthSalesAmountLineChartDto> salesAmount = indexService.getMonthSalesAmountLineChartForPc(req);
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "所有门店当月目标单数及销售金额达成率", notes = "ywb")
    @GetMapping("/getDeptSalesAchievementRateForPc")
    public ResultObject<DeptSalesAchievementRateDto> getDeptSalesAchievementRate(ReqIndexDto req) {
        DeptSalesAchievementRateDto rate = indexService.getDeptSalesAchievementRate(req);
        return ResultObject.ok().setData(rate);
    }

    @ApiOperation(value = "开单比例", notes = "ywb")
    @GetMapping("/getBillingRate")
    public ResultObject<BillingRateDto> getBillingRate(ReqIndexDto req) {
        BillingRateDto rate = indexService.getBillingRate(req);
        return ResultObject.ok().setData(rate);
    }
//
//    @ApiOperation(value = "获取今日/昨日销售金额", notes = "ywb")
//    @GetMapping("/getDaySalesAmount")
//    public ResultObject<DaySalesAmountDto> getDaySalesAmount() {
//        DaySalesAmountDto salesAmount = indexService.getDaySalesAmount();
//        return ResultObject.ok().setData(salesAmount);
//    }
//

//
//    @ApiOperation(value = "获取当月/上月销售金额", notes = "ywb")
//    @GetMapping("/getMonthSalesAmount")
//    public ResultObject<MonthSalesAmountDto> getMonthSalesAmount() {
//        MonthSalesAmountDto salesAmount = indexService.getMonthSalesAmount();
//        return ResultObject.ok().setData(salesAmount);
//    }
//
//    @ApiOperation(value = "获取本月销售产品占比（饼图）", notes = "ywb")
//    @GetMapping("/getMonthSalesProductPieChart")
//    public ResultObject<List<MonthSalesProductPieChartDto>> getMonthSalesProductPieChart() {
//        List<MonthSalesProductPieChartDto> pirChart = indexService.getMonthSalesProductPieChart();
//        return ResultObject.ok().setData(pirChart);
//    }
//
//    @ApiOperation(value = "获取本月销售公司占比（饼图）", notes = "ywb")
//    @GetMapping("/getMonthSalesSealPieChart")
//    public ResultObject<List<MonthSalesSealPieChartDto>> getMonthSalesSealPieChart() {
//        List<MonthSalesSealPieChartDto> pirChart = indexService.getMonthSalesSealPieChart();
//        return ResultObject.ok().setData(pirChart);
//    }
//
//



}
